$(function() {
	function loading(href) {
		var speed = 500,
			newframe = $("<iframe class='newframe' src='" + href + "'></iframe>");

		newframe.attr("style",
			"-webkit-transition: -webkit-transform " + speed + "ms ease, transform " + speed + "ms ease; " +
			"transition: transform " + speed + "ms ease, -webkit-transform " + speed + "ms ease;"
		);
		$("body").append(newframe);

		$(".container").attr("style",
			"-webkit-transition: transform " + speed + "ms ease; " +
			"transition: transform " + speed + "ms ease; " +
			"-webkit-transform: translate3d(-50%, 0, 0); " +
			"transform: translate3d(-50%, 0, 0);"
		);

		setTimeout(function() {
			newframe.addClass("show");
		}, 10);

		//		setTimeout(href, speed + 100);
		//		setTimeout(function() {
		//			$(".container").removeAttr("style");
		//			newframe.remove();
		//		}, speed * 2);
	}

	$(".main a").on("click", function() {
		if(!$(this).attr("data-ent") && !$(this).attr("data-action")) {
			loading($(this).attr("href"));
//			console.log($(".newframe")["0"].contentDocument.body.outerHTML);
//			console.log($(window.frames[0].document))

//			$(".newframe")["0"].contentDocument.body.find(".container [data-action]").on("click", function() {
//				//返回
//				if($(this).data("action") == "back") {
//					alert("bgg");
//
//					//其它情况
//				} else {
//					alert("参数错误！");
//				}
//
//				return false;
//			});

			return false;
		}
	});
});